import Vue from 'vue';
import Cookies from 'js-cookie';
import 'normalize.css/normalize.css';
import Element from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import '@/styles/index.scss';
import App from './App';
import store from './store';
import router from './router';
import * as filters from './filters';
import '@/icons'; // icon
import '@/permission'; // permission control
import Viewer from 'v-viewer'; // 导入图片点击放大
import 'viewerjs/dist/viewer.css';

// import ElInputValidate from 'el-input-validate';
// ElInputValidate(Vue);

// copy-paste
import VueClipboard from 'vue-clipboard2';
Vue.use(VueClipboard);
/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
// if (process.env.NODE_ENV !== 'production') {
//   const { mockXHR } = require('../mock');
//   mockXHR();
// }

Vue.use(Viewer); // image blow up
Viewer.setDefaults({
  Options: {
    'inline': true,
    'button': true,
    'navbar': true,
    'title': true,
    'toolbar': true,
    'tooltip': true,
    'movable': true,
    'zoomable': true,
    'rotatable': true,
    'scalable': true,
    'transition': true,
    'fullscreen': true,
    'keyboard': true,
    'url': 'data-source'
  }
});

Vue.use(Element, {
  size: Cookies.get('size') || 'medium'
});

Vue.prototype.turnBackPrev = () => {
  window.history.go(-1);
};

Vue.prototype.checkArr = (arr) => {
  if (arr && arr.length > 0) return true;
  return false;
};
Vue.config.productionTip = false;
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key]);
});
new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
});
